const tools = {
  isIos: function () {
    const u = navigator.userAgent;
    let isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
    return isiOS; // ios终端
  },
  isAndrid: function () {
    let u = navigator.userAgent;
    let isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
    return isAndroid
  },
  getTimeStr: function (time) {
    time = parseInt(time)
    let oDate = new Date(time)

    let oYear = oDate.getFullYear(),
      oMonth = oDate.getMonth() + 1,
      oDay = oDate.getDate(),
      oHour = oDate.getHours(),
      oMinute = oDate.getMinutes(),
      oTime = oYear + "-" + this.getzf(oMonth) + "-" + this.getzf(oDay) + " " + this.getzf(oHour) + ":" + this.getzf(oMinute);
    return oTime;
  },
  getzf(num) {
    if (parseInt(num) < 10) {
      num = "0" + num;
    }
    return num;
  }
}

export default tools;